export interface User {
  username: string,
  password: string,
  id?: string
}

// 用户
export const userList: User[] = [
  {
    id: "1",
    username: "admin",
    password: "admin",
  },
  {
    id: "2",
    username: "user",
    password: "user",
  },
  {
    id: "3",
    username: "test",
    password: "test",
  },
  {
    id: "4",
    username: "test1",
    password: "test1",
  }
]


// 用户角色对应表
export const userRoleList = [
  {
    userId: "1",
    roleId: "1"
  },
  {
    userId: "2",
    roleId: "2"
  }
]


// 角色
export const roleList = [
  {
    id: "1",
    role: "admin",
    name: "超级管理员",
    desc: "拥有所有权限",
  },
  {
    id: "2",
    role: "userAdmin",
    name: "普通用户",
    desc: "拥有部分权限",
  }
]

export interface RouterItem {
  path: string;
  name: string;
  redirect?: string;
  component?: string;
  meta: {
    title: string;// 路由标题
    icon?: string;// 路由图标
    roles?: string[];// 路由角色
    noCache?: boolean;// 路由是否不缓存
    alwaysShow?: boolean;// 路由是否始终显示在左侧菜单中
    hidden?: boolean;// 路由是否在左侧菜单中隐藏
    affix?: boolean;// 路由是否固定在标签栏中
    activeMenu?: string;// 路由激活时左侧菜单的高亮
    permissions?: string[];// 路由权限，页面的操作权限
    canTo?: boolean;// 路由是否有权限访问
    noTagsView?: boolean;// 路由是否不显示在标签栏中
    perimission?: string;// 路由权限，页面的操作权限
  };
  children?: RouterItem[]
}


// 路由配置
export const AsyncRouter: RouterItem[] = [
  {
    path: "/welcome",
    name: "Welcome",
    meta: {
      title: "Welcome",
      hidden: true,
      roles: ["admin", "userAdmin"],
    },
    component: "#",
    children: [
      {
        path: "index",
        name: "Welcome",
        meta: {
          title: "Welcome",
          roles: ["admin", "userAdmin"],
        },
        component: "/welcome/Welcome",
      },
    ],
  },
  {
    path: "/dashboard",
    name: "Dashboard",
    component: "#",
    redirect: "/dashboard/analysis",
    meta: {
      title: "首页",
      icon: "el:House",
      roles: ["admin", "userAdmin"],
    },
    children: [
      {
        path: "analysis",
        name: "Analysis",
        component: "/dashboard/Analysis",
        meta: {
          title: "分析页",
          roles: ["admin", "userAdmin"],
          permissions: ["query", "add", "delete"],
        },
      },
      {
        path: "workplace",
        name: "Workplace",
        component: "/dashboard/Workplace",
        meta: {
          title: "工作台",
          roles: ["admin", "userAdmin"],
        },
      },
    ]
  },
  {
    path: "/authorization",
    component: "#",
    name: "Authorization",
    redirect: "/authorization/department",
    meta: {
      title: "权限管理",
      icon: "el:SetUp",
      roles: ["admin"],
    },
    children: [
      {
        path: "department",
        name: "Department",
        component: "/authorization/Department",
        meta: {
          title: "部门管理",
          roles: ["admin"],
        },
      },
      {
        path: "user",
        name: "User",
        component: "/authorization/User",
        meta: {
          title: "用户管理",
          roles: ["admin", "userAdmin"],
        },
      },
      {
        path: "menu",
        name: "Menu",
        // component: "##",
        redirect: "/authorization/menu/menu-1",
        meta: {
          title: "菜单管理",
          roles: ["admin", "userAdmin"],
          alwaysShow: true
        },
        children: [
          {
            path: "menu-1",
            name: "Menu",
            component: "/authorization/Menu",
            meta: {
              title: "一级菜单管理",
              roles: ["admin", "userAdmin"],
            },
          },
        ]
      },
      {
        path: "role",
        name: "Role",
        component: "/authorization/Role",
        meta: {
          title: "角色管理",
          roles: ["admin"],
        },
      }
    ]
  },
  {
    path: "/system",
    name: "System",
    component: "#",
    redirect: "/system/log",
    meta: {
      title: "系统管理",
      icon: "el:Coin",
      roles: ["admin"],
    },
    children: [
      {
        path: "log",
        name: "Log",
        component: "/system/Log",
        meta: {
          title: "日志管理",
          roles: ["admin", "userAdmin"],
        },
      },
      {
        path: "public",
        name: "Public ",
        component: "/system/Public",
        meta: {
          title: "通知管理",
          roles: ["admin"],
        },
      },
      {
        path: "config",
        name: "Config ",
        component: "/system/Config",
        meta: {
          title: "配置管理",
          roles: ["admin"],
        },
      },
    ]
  },
  {
    path: "/system-monitor",
    name: "SystemMonitor",
    component: "#",
    redirect: "/system-monitor/online-user",
    meta: {
      title: "系统监控",
      icon: "el:Coin",
      roles: ["admin"],
    },
    children: [
      {
        path: "online-user",
        name: "OnlineUser",
        component: "/systemMonitor/OnlineUser",
        meta: {
          title: "在线用户",
          roles: ["admin", "userAdmin"],
        },
      },
      {
        path: "login-log",
        name: "LoginLog ",
        component: "/systemMonitor/LoginLog",
        meta: {
          title: "登录日志",
          roles: ["admin"],
        },
      },
      {
        path: "service-monitor",
        name: "ServiceMonitor ",
        component: "/systemMonitor/ServiceMonitor",
        meta: {
          title: "服务监控",
          roles: ["admin"],
        },
      }
    ]
  }
]
